package com.sl.javatest;

import java.util.Objects;

/**
 * author： suliang
 * 2023/1/3 16:08
 * describe : 对象
 */
public class Person {
    public String nick ;
    String name ;
    int age ;

    public Person(){}

    public Person(String x){
        this.nick = x;
    }

    public Person(int age){
        this.age = age ;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    private void initX(){
        System.out.println("xxxxxxxxxxxxxxxxxxxxxx");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return age == person.age && Objects.equals(nick, person.nick) && Objects.equals(name, person.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(nick, name, age);
    }
}
